import {
	getCustomNav
} from '@/util/util.js'
import config from '@/config.js';
export default {
	methods: {
		navigate(url) {
			if (url) {
				uni.navigateTo({
					url: url
				});
			} else {
				this.showToast('开发中，敬请期待！')
			}
		},
		back() {
			uni.navigateBack({
				fail() {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}
			})
		},
		switchTab() {
			uni.switchTab({
				url: '/pages/index/index'
			})
		},
		reLaunch(url) {
			uni.reLaunch({
				url: url
			})
		},
		call(phone) {
			uni.makePhoneCall({
				phoneNumber: phone
			})
		},
		openMap(latitude, longitude, name) {
			uni.openLocation({
				latitude: latitude * 1,
				longitude: longitude * 1,
				name
			})
		}
	},
	computed: {
		mt() {
			let custom = getCustomNav();
			return custom.statusBar + custom.nvaMartom + custom.navHeight + 20 + 'rpx';
		},
	},
	data() {
		return {
			imgStorage: 'https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhouHousesLease/uniapp',
			backendStorage:'https://housing-1306862033.cos.ap-chengdu.myqcloud.com/file/',
			cloudStorage: config.cloudStorage,
		}
	},
	onPageScroll(e) {
		this.topBgColor = e.scrollTop >= 1 ? '#fb4744' : 'rgba(0,0,0,0)'
		this.titleColor = e.scrollTop >= 1 ? '#fff' : '#000'
	}
}